<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <title>学生添加页面</title>
    <link rel="stylesheet" type="text/css" href="../static/admin/layui2/css/layui.css"/>
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
    <div class="layui-header">
        <div class="layui-logo"><a href="guanliyuan-main.html" style="color: #009688;font-size: 25px;">管理员主页面</a></div>
        <!-- 头部区域（可配合layui已有的水平导航） -->
        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item"><a class="layui-icon layui-icon-user" style="color:#009688;font-size: 20px;text-align: center;" href="student-login.html">学生登录</a></li>
            <li class="layui-nav-item"><a class="layui-icon layui-icon-logout" style="color: #ff3c00;font-size: 20px;text-align: center;" href="guanliyuan-login.html">退出</a></li>
        </ul>
    </div>

    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
            <ul class="layui-nav layui-nav-tree"  lay-filter="test">
                <li class="layui-nav-item">
                    <a href="javascript:;"><i class="layui-icon layui-icon-username" style="font-size: 24px; color: #009688; margin-right: 16px"></i> 信息管理</a>
                    <dl class="layui-nav-child">
                        <dd><a href="guanliyuan-mimaChange.html"><i class="layui-icon layui-icon-edit" style="font-size: 24px; color: #009688; margin-right: 16px"></i>修改密码</a></dd>
                        <dd><a href="guanliyuan-add.html"><i class="layui-icon layui-icon-add-circle" style="font-size: 24px; color: #009688; margin-right: 16px"></i>添加管理员</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;"><i class="layui-icon layui-icon-user" style="font-size: 24px; color: #009688; margin-right: 16px"></i>学生管理</a>
                    <dl class="layui-nav-child">
                        <dd><a href="guanliyuan-addstudent.html" class="layui-this"><i class="layui-icon layui-icon-add-circle" style="font-size: 24px; color: #009688; margin-right: 16px"></i>添加学生</a></dd>
                        <dd><a href="guanliyuan-deletestudent.html"><i class="layui-icon layui-icon-reduce-circle" style="font-size: 24px; color: #009688; margin-right: 16px"></i>删除学生</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;"><i class="layui-icon layui-icon-group" style="font-size: 24px; color: #009688; margin-right: 16px ;"></i>校友管理</a>
                    <dl class="layui-nav-child">
                        <dd><a href="guanliyuan-addalumni.html"><i class="layui-icon layui-icon-add-circle" style="font-size: 24px; color: #009688; margin-right: 16px"></i>添加校友</a></dd>
                        <dd><a href="guanliyuan-alumni.html"><i class="layui-icon layui-icon-friends" style="font-size: 24px; color: #009688; margin-right: 16px"></i>校友信息</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item layui-nav-iteme">
                    <a href="javascript:;"><i class="layui-icon layui-icon-rmb" style="font-size: 24px; color: #009688; margin-right: 16px"></i>奖学金管理</a>
                    <dl class="layui-nav-child">
                        <dd><a href="guanliyuan-addscholarship.html"><i class="layui-icon layui-icon-add-circle" style="font-size: 24px; color: #009688; margin-right: 16px"></i>添加奖学金</a></dd>
                        <dd><a href="guanliyuan-scholarship.html"><i class="layui-icon layui-icon-file" style="font-size: 24px; color: #009688; margin-right: 16px"></i>奖学金信息</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item layui-nav-iteme">
                    <a href="guanliyuan-examine.html"><i class="layui-icon layui-icon-survey" style="font-size: 24px; color: #009688; margin-right: 16px"></i>审批</a>
                </li>
            </ul>
        </div>
    </div>

    <div class="layui-body">
        <div class="layui-anim layui-anim-scale" style="margin-top: 50px;margin-left: 50px;">
            <form class="layui-form layui-form-pane" name="form1" id="form1">
                <div class="layui-form-item">
                    <label class="layui-form-label">学号</label>
                    <div class="layui-input-inline">
                        <input type="text" name="number" id="number" lay-verify="required" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">姓名</label>
                    <div class="layui-input-inline">
                        <input type="text" name="name" id="name" lay-verify="required" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">性别</label>
                    <div class="layui-input-inline">
                        <input type="radio" name="gender" id="male" value="1" title="男" checked>
                        <input type="radio" name="gender" id="female" value="0" title="女">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">班级</label>
                    <div class="layui-input-inline">
                        <input type="text" name="clazz" id="clazz" lay-verify="required" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">所在学院</label>
                    <div class="layui-input-inline">
                        <select name="department" id="department" lay-verify="required">
                            <option value=""></option>
                            <option value="软件学院">软件学院</option>
                            <option value="信息工程学院">信息工程学院</option>
                            <option value="水环学院">水环学院</option>
                            <option value="土建学院">土建学院</option>
                            <option value="测绘工程学院">测绘工程学院</option>
                            <option value="核工学院">核工学院</option>
                            <option value="理学院">理学院</option>
                            <option value="化生材学院">化生材学院</option>
                            <option value="地科学院">地科学院</option>
                            <option value="地控学院">地控学院</option>
                            <option value="机电学院">机电学院</option>
                            <option value="外国语学院">外国语学院</option>
                            <option value="体育学院">体育学院</option>
                            <option value="国际教育学院">国际教育学院</option>
                            <option value="经管学院">经管学院</option>
                            <option value="文法学院">文法学院</option>
                            <option value="艺术学院">艺术学院</option>
                            <option value="研究生院">研究生院</option>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">专业</label>
                    <div class="layui-input-inline">
                        <input type="text" name="major" id="major" lay-verify="required" class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">电话</label>
                    <div class="layui-input-inline">
                        <input type="text" name="phone" id="phone" autocomplete="off" lay-verify="phone" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">邮箱</label>
                    <div class="layui-input-inline">
                        <input type="text" name="mail" id="mail" lay-verify="email" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">政治面貌</label>
                    <div class="layui-input-inline">
                        <select name="politic" id="politic" lay-verify="required">
                            <option value=""></option>
                            <option value="群众">群众</option>
                            <option value="团员">团员</option>
                            <option value="党员">党员</option>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">获奖情况</label>
                    <div class="layui-input-inline">
                        <textarea name="awards" class="layui-textarea" style="width: 500px"></textarea>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-inline">
                        <button type="submit" class="layui-btn" lay-submit="" lay-filter="demo1">添加</button>
                    </div>
                </div>
            </form>
        </div>
    </div>

    <div class="layui-footer layui-bg-green">

    </div>
</div>
<script src="../static/admin/layui2/layui.js" type="text/javascript" charset="utf-8"></script>
<script>
    layui.use(['element','form','jquery','layer','laydate'], function(){
        var element = layui.element
        var form = layui.form
        layer = layui.layer
        $ =layui.jquery;


        form.render();
        form.on('submit(demo1)',function (data) {
            $.ajax({
                type:"POST",
                url:"/guanliyuan/addStudent",
                data:{
                    "number": data.field.number,
                    "name": data.field.name,
                    "gender": data.field.gender,
                    "clazz": data.field.clazz,
                    "department":data.field.department,
                    "major":data.field.major,
                    "phone":data.field.phone,
                    "mail":data.field.mail,
                    "politic":data.field.politic,
                    "awards":data.field.awards,
                },
                dataType:"json",
                success:function (res) {
                    if (res.flag){
                        layer.msg('添加成功', {icon: 1});
                        setTimeout(function () {
                            window.location.href="guanliyuan-addstudent.html";
                        },1000)
                    }else {
                        layer.msg(res.msg,{icon: 5});
                    }
                }
            })
            return false;
        });
    });
</script>
</body>

</html>